/* @(#)DefineDic.java   
 *
 * Project: GS
 *
 * Modify Information:
 * =============================================================================
 *   Author       Date       Description
 *   ------------ ---------- ---------------------------------------------------
 *   zhouyijia    2008-07-10     新增常量字典
 *
 * Copyright Notice:
 * =============================================================================
 *    Copyright (c) 2001-2007 Auto-Parts E-Procurement Co., Ltd. 
 *        No.251-1 Wuning Road, Shanghai, 200063, China All rights reserved.
 *
 *    This software is the confidential and proprietary information of
 *        Auto-Parts E-Procurement Co., Ltd. ("Confidential Information").
 *        You shall not disclose such Confidential Information and shall use it
 *        only in accordance with the terms of the license agreement you entered
 *        into with APEP.
 *
 * Warning:
 * =============================================================================
 *  
 */
package com.hitrust.gs.util;

import java.util.HashMap;

import com.hitrust.gs.bean.GSProductTypeManagerBean;
import com.hitrust.gs.dao.GSProductTypeManagerDao;
import com.hitrust.gs.lib.GSBaseConstants;

public class DefineDic {
    
    //订单状态
    private static HashMap ORDER_STATUS      = new HashMap();
    
    static {

        ORDER_STATUS.put(GSBaseConstants.ORDER_APPLY               , "申请");
        ORDER_STATUS.put(GSBaseConstants.ORDER_FIRSTAUDIT_PASS     , "初审通过");
        ORDER_STATUS.put(GSBaseConstants.ORDER_SECONDAUDIT_PASS    , "复审通过");
        ORDER_STATUS.put(GSBaseConstants.ORDER_FIRSTAUDIT_FAILURE  , "初审未通过");
        ORDER_STATUS.put(GSBaseConstants.ORDER_SECONDAUDIT_FAILURE , "复审未通过");
        ORDER_STATUS.put(GSBaseConstants.ORDER_SUBMIT              , "已提交");
        ORDER_STATUS.put(GSBaseConstants.ORDER_AUTHORISE           , "已核准");
        ORDER_STATUS.put(GSBaseConstants.ORDER_AUTHORISE_FAILURE   , "未核准");
        ORDER_STATUS.put(GSBaseConstants.ORDER_ORDERING            , "订货中");
        ORDER_STATUS.put(GSBaseConstants.ORDER_ORDER_CONFIRM       , "已确认（订单确认,送货确认）");
        ORDER_STATUS.put(GSBaseConstants.ORDER_ORDER_REJECT        , "已拒绝（订单拒绝，送货拒绝）");
        ORDER_STATUS.put(GSBaseConstants.ORDER_DELIVERY_CONFIRM    , "交货确认");
        ORDER_STATUS.put(GSBaseConstants.ORDER_GATHERING_CONFIRM   , "收款确认");
        ORDER_STATUS.put(GSBaseConstants.ORDER_FINISH              , "已完成");
        ORDER_STATUS.put(GSBaseConstants.ORDER_FILL_ORDER          , "补单");
        ORDER_STATUS.put(GSBaseConstants.ORDER_FILL_ORDER_CONFIRM  , "补单确认");
        ORDER_STATUS.put(GSBaseConstants.ORDER_WITHDRAW_GOODS      , "退货");
        ORDER_STATUS.put(GSBaseConstants.ORDER_CANCEL              , "取消");
        ORDER_STATUS.put(GSBaseConstants.ORDER_BLANK_OUT           , "作废");
        
    }
    
    public static String getOrderStatus(String aStatus) {
        return (String) ORDER_STATUS.get(aStatus);
    }
    
    //结算模式
    private static  HashMap BALANCE_MODE     = new HashMap();
    static {

        BALANCE_MODE.put(GSBaseConstants.BALANCE_MODE1     , "压库");
        BALANCE_MODE.put(GSBaseConstants.BALANCE_MODE2     , "买断");
     }
    //申购单状态
    private static HashMap APPLY_STATUS=new HashMap();
    static{
        APPLY_STATUS.put(GSBaseConstants.ORDER_SUPPLY_APPLY, "申请");
        APPLY_STATUS.put(GSBaseConstants.ORDER_SUPPLY_AGREE, "已完成");
        APPLY_STATUS.put(GSBaseConstants.ORDER_SUPPLY_NOAGREE, "已拒绝");
    }
    
    
    //区域
    private static  HashMap PRODUCT_TYPE   = new HashMap();
    static {
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_1     , "一类");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_2     , "二类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_3     , "三类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_4     , "四类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_5     , "五类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_6     , "六类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_7     , "七 类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_8     , "八 类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_9     , "九 类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_10    , "十类 ");
    	PRODUCT_TYPE.put(GSBaseConstants.PRODUCT_TYPE_OTHER    , "其他");
     }
    
    public static String getProductType(String status)throws Exception{
    	GSProductTypeManagerDao dao =new GSProductTypeManagerDao();
    	GSProductTypeManagerBean bean=dao.findByTypeCodeAndPUpperCode(status, "1000");
        if(bean==null){
        	return "";
        }else{
        	return bean.getType_name();
        }
    	
    }
    public static String getProductBid(String status)throws Exception{
    	GSProductTypeManagerDao dao =new GSProductTypeManagerDao();
    	GSProductTypeManagerBean bean=dao.findByTypeCodeAndPUpperCode(status, "2000");
        if(bean==null){
        	return "";
        }else{
        	return bean.getType_name();
        }
    	
    }
    public static String getApplyStatus(String status){
        return (String) APPLY_STATUS.get(status);
    }
    
    public static String getBalanceMode(String aMode) {
        return (String) BALANCE_MODE.get(aMode);
    }
    public static String getBmode(String mode){
        String temp=GSBaseConstants.BALANCE_MODE1;
        if(mode==null){
            return temp;
        }else if(!GSBaseConstants.BALANCE_MODE2.equals(mode)){
            return temp;
        }else{
            return mode;
        }
    }
}